<div id="content">
	<%= render 'administrator/tabs' %>
</div>
<h2>Search authentications</h2>
<div class="form-search">
	<%= render 'search' %>
</div>
<h2>Listing authentications</h2>
<table class="scaffold-table">
	<tr>
		<th>NO.</th>
		<th>Group</th>
		<th>Permission</th>
		<th>Code/Model</th>
		<th>Can Read</th>
		<th>Can Create</th>
		<th>Can Update</th>
		<th>Can Destroy</th>
		<th>View</th>
		<th>Edit</th>
		<th>Delete</th>
	</tr>
	<% @authentications.each_with_index do |authentication,index| %>
	<tr>
		<td><%= index+1 %></td>
		<td><%= authentication.group.name %></td>
		<td><%= authentication.permission.name %></td>
		<td><%= authentication.permission.model.name %></td>
		<td class="command">
		<% if authentication.can_read? %>
			<%= image_tag("enable-icon.png", :border => 0) %>
		<% else %>
			<%= image_tag("disable-icon.png", :border => 0) %>
		<% end %> 
		</td>
		<td class="command">
		<% if authentication.can_create? %>
			<%= image_tag("enable-icon.png", :border => 0) %>
		<% else %>
			<%= image_tag("disable-icon.png", :border => 0) %>
		<% end %> 
		</td>
		<td class="command">
		<% if authentication.can_update? %>
			<%= image_tag("enable-icon.png", :border => 0) %>
		<% else %>
			<%= image_tag("disable-icon.png", :border => 0) %>
		<% end %> 
		</td>
		<td class="command">
		<% if authentication.can_destroy? %>
			<%= image_tag("enable-icon.png", :border => 0) %>
		<% else %>
			<%= image_tag("disable-icon.png", :border => 0) %>
		<% end %> 
		</td>
		
		
		<td class="command"> <% if can? :read, Authentication %>
		<%= link_to image_tag("view-icon.png", :border => 0) , authentication  %>
		<% else %>
		-
		<% end %> </td>
		<td class="command"> <% if can? :update, Authentication %>
		<%= link_to image_tag("edit-icon.png", :border => 0) , edit_authentication_path(authentication)  %>
		<% else %>
		-
		<% end %> </td>
		<td class="command"> <% if can? :destroy, Authentication %>
		<%= link_to image_tag("delete-icon.png", :border => 0) , authentication , :confirm => 'Are you sure?', :method => :delete %>
		<% else %>
		-
		<% end %> </td>
	</tr>
	<% end %>
</table>
<%= will_paginate @authentications %>
<% if can? :create , Branch %>
<%= link_to image_tag("add-icon.png", :border => 0) , new_authentication_path , {:class => 'form-command'} %>
<%= link_to 'New Authentication', new_authentication_path %>
<% end %>